package com.yang.lay;


import com.yang.lay.core.JwtPermission.ApiInterceptor;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.web.servlet.ServletComponentScan;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;


@ServletComponentScan
@SpringBootApplication
@ComponentScan

public class LayuiwebApplication {

	public static void main(String[] args) {
		SpringApplication.run(LayuiwebApplication.class, args);
		System.out.println("ヾ(◍°∇°◍)ﾉﾞ    启动成功      ヾ(◍°∇°◍)ﾉﾞ\n" );

	}
	@Configuration   //标注此文件为一个配置项，spring boot才会扫描到该配置。该注解类似于之前使用xml进行配置
	public class CustomWebMvcConfigurerAdapter extends WebMvcConfigurerAdapter {
		@Override
		public void addInterceptors(InterceptorRegistry registry) {
			registry.addInterceptor(new ApiInterceptor()).addPathPatterns("/api/**").excludePathPatterns("/api/login");//对来自/api/** 这个链接来的请求进行拦截

		}
	}
}
